package database;

import java.sql.Connection;
import java.sql.DriverManager;
/**
 *DBConnection class manages database connections
 *
 */
public class DBConnection {
	/**
	 * Connects to database service
	 * @return
	 * @throws Exception
	 */
public static synchronized Connection getConnection() throws Exception {
		
		Class.forName("oracle.jdbc.driver.OracleDriver");
		String dbName= "COMMERCE";
		String password = "commerce";
		Connection con = DriverManager.getConnection("jdbc:oracle:thin:@127.0.0.1:1521:XE", dbName , password);
		con.setTransactionIsolation( Connection.TRANSACTION_READ_COMMITTED );
		con.setAutoCommit( false );
		System.out.println("b****");
		return con ;
		
	}
/**
 * Close database connection
 * @param con
 */
	public static synchronized void closeConnection( Connection con ) {
		
		try {
			con.close();
		} catch ( Exception ex ) {
		}
		
		
	}
	
}
